<template>
	<Layout :class="'bg-white p-2'">
		<Row :class="'m-1'">
            <Col span="2">
                <label>体训师ID:{{trainerAccount.trainerId}}</label>
            </Col>
            <Col span="5">
                <label>开始时间:{{trainerAccount.startDate}}</label>
            </Col>
            <Col span="5">
                <label>结束时间:{{trainerAccount.endDate}}</label>
            </Col>
            <Col span="3">
                <label>状态:{{trainerAccount.statu}}</label>
            </Col>
            <Col span="3">
                <label>金额:{{trainerAccount.amount}}</label>
            </Col>
            <Col span="2">
            	<Button class="m-2" type="primary" shape="circle" @click="settle()" >结算</Button>
            </Col>
            <!-- <Col span="2">
            	<Button class="m-2" type="primary" shape="circle" @click="test()" >测试</Button>
            </Col> -->
            <Col span="2">
            	<Button class="m-2" type="primary" shape="circle" @click="cancel()" >返回</Button>
            </Col>
<!-- 			<Button type="error" @click="newUser">新增</Button>
			<Input :class="'w-25 m-2'" v-model="searchKey" placeholder="请输入检索关键字" />
			<Button type="primary" shape="circle" @click="search" icon="ios-search">查询</Button> -->
			   <!--     <Col span="4">
						<Input :class="'w-75 m-2'" v-model="searchLessionId" placeholder="请输入课程编号" />
					</Col>
			       <Col span="4">
			       	<Input :class="'w-75 m-2'" v-model="searchCourseName" placeholder="请输入课程名" />
			       </Col>
				   <Col span="4">
				   	<Input :class="'w-75 m-2'" v-model="searchStoreName" placeholder="请输入门店名称" />
				   </Col>
				   <Col span="4">
				   	<Input :class="'w-75 m-2'" v-model="searchTrainerId" placeholder="请输入体训师编号" />
				   </Col>
					 <Col span="4">
					 	<Button class="m-2" type="primary" shape="circle" @click="search" icon="ios-search">查询</Button>
					 </Col>-->
                     
		</Row> 
		<Layout :class="'bg-white'">
			<Table border :class="'m-1'" :columns="tableInfo.columnInfo" :data="tableInfo.data">
				<!-- <template slot-scope="{ row, index }" slot="action">
					<Button type="primary" size="small" style="margin-right: 5px" @click="show(row.lessionId)">详细</Button>
					<Button type="error" size="small" @click="remove(row.lessionId)">删除</Button>
				</template> -->
			</Table>
			<Page :class="'m-2 text-right'" :page-size="tableInfo.pageSize" @on-change="pageSearch" :total="tableInfo.total" />
		</Layout>
	</Layout>
</template>
<script>
	export default {
		data() {
			return {

				
				tableInfo: {
					currentPage: 1,
					total: 0,
					columnInfo: [
						{
							title: "记录编号",
							key: "recordId",
							width: 100
						},
						{
							title: "顾客编号",
							key: "clientId",
							width: 100
						},
						{
							title: "课程名",
							key: "courseName",
							width: 200
						},
						{
							title: "体训师姓名",
							key: "trainerName",
							width: 200
						},
					
						{
							title: "课程价格",
							key: "coursePrice",
							width: 200
						},
						
						{
							title: "开始时间",
							key: "startTime",
							width: 250
						},
						{
							title: "结束时间",
							key: "endTime",
							width: 250
						}
						
						
					],
					data: []
				},
                trainerAccount: {
                    acountId: '',
                    trainerId: '',
                    startDate: '',
                    endDate: '',
                    amount: '',
                    statu: ''
                    
                }
				
			}
		},
		methods: {
			init: function() {
				this.$data.tableInfo.currentPage = 0;
				this.search();
                let self = this;
                
                self.http.get({
                	url: "/trainer-account/info",
                	param: {
                		acountId: self.$route.params.acountId
                	}
                }).then(data => {
                	console.log(data);
                	self.$data.trainerAccount = data;
                	// self.$data.order.sex += "";
                });
			},
            settle: function(){
                let self = this;
                self.http.post({
                	url: "/trainer-account/info",
                	param: self.$data.trainerAccount
                        
                    
                	
                }).then(data => {
                	
                	self.message.info("结算成功");
                	self.$tabs.close();
                    this.$router.push({
                    	name: 'trainer_accounts',
                    	
                    });
                	// self.$data.order.sex += "";
                });
            },
            // test: function(){
            //     let self = this;
            //     self.http.put({
            //     	url: "/trainer-account/test",
                	
            //         param:{test:'测试'}
                    
                    
                	
            //     }).then(data => {
                	
            //     	self.message.info("测试成功");
            //     	// self.$tabs.close();
            //     	// self.$data.order.sex += "";
            //     });
            // },
			// newLession: function() {
			// 	this.$router.push({
			// 		name: "lession_new"
			// 	});
			// },
			// show: function(lessionId) {
			// 	this.$router.push({
			// 		name: "lession_detail",
			// 		params: {
			// 			lessionId
			// 		}
			// 	});
			// },
			// update(acountId){
			// 	this.$router.push({
			// 		name: "lession_update",
			// 		params: {
			// 			acountId
			// 		}
			// 	});
			// },
			
			search: function() {
				this.http.get({
					url: "/lessonrs/t-list",
					param: {
						currentPage: this.$data.tableInfo.currentPage,
                        acountId: this.$route.params.acountId
						// searchLessionId: this.$data.searchLessionId,
						// searchCourseName: this.$data.searchCourseName,
						// searchStoreName: this.$data.searchStoreName,
						// searchTrainerId: this.$data.searchTrainerId
					}
				}).then(data => {
					this.$data.tableInfo.currentPage = data.current;
					this.$data.tableInfo.total = data.total;
					this.$data.tableInfo.pageSize = data.size;
					this.$data.tableInfo.data = data.records;
				});
			},
			pageSearch: function(changedPage) {
				this.$data.tableInfo.currentPage = changedPage;
				this.search();
			},
            cancel: function() {
            
            	this.$tabs.close();
            },
		},
		created: function() {
            // this.$data.trainerAccount.acountId=this.$route.params.acountId;
			this.init();
		}
		
	}
</script>

<style>
	
</style>
